<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>


<div class="row">
	<div class="col-lg-12">
		<div class="row">
			<div class="col-md-4">
				<div class="btn-group m-b-1" role="group">
					<?php echo admin_tab_active($menu['plugin']['tab'], $action);?>
				</div>
			</div>
			<div class="col-md-8 text-right">
				<div class="btn-group m-b-1" role="group">
					<?php echo $pugin_cate_html;?>
				</div>
			</div>
			
		</div>
		<div class="card">
			<div class="table-responsive">
				<table class="table" style="min-width: 800px">
					<?php foreach($pluginlist as $dir=>$plugin) { ?>
										
					<?php
						$plugin['version_fmt'] = $action == 'local' ? $plugin['version'] : $plugin['official_version'];
					?>

					<tr valign="top" dir="<?php echo $dir; ?>">
						<td width="60">
							<a href="<?php echo url("plugin-read-$dir");?>" target="_blank">
								<img src="<?php echo $plugin['icon_url']; ?>" width="54" height="54" />
							</a>
						</td>
						<td width="300">
							<a href="<?php echo url("plugin-read-$dir");?>"><b><?php echo $plugin['name']; ?> </b></a>
							<span class="small">v<?php echo $plugin['version_fmt']; ?> </span>
							<?php if($plugin['have_upgrade']) { ?>
							<span class="small text-danger text-bold">v<?php echo $plugin['official_version']; ?> </span>
							<?php } ?>
							<br /><span class="small"><?php echo $dir; ?></span>
							
							<?php if(!empty($plugin['username'])) { ?>
							<br /><span class="small"><?php echo lang('author'); ?>：
							<a href="http://bbs.xiuno.com/user-<?php echo $plugin['uid'];?>.htm" target="_blank"><?php echo $plugin['username'];?></span></a>
							<?php } ?>
						</td>
						<td>
							<p class="grey"><?php echo $plugin['brief']; ?></p>
						</td>
						<td width="250" align="right">
						
							<?php if(!$plugin['downloaded']) { ?>
							<a role="button" class="btn btn-primary download" href="<?php echo url("plugin-download-$dir"); ?>"><?php echo lang('download');?></a>
							<?php } ?>
							
							<?php if($plugin['setting_url']) { ?>
							<a role="button" class="btn btn-primary setting" href="<?php echo url("plugin-setting-$dir"); ?>"><?php echo lang('setting');?></a>
							<?php } ?>
							
							<?php if(!$plugin['installed'] && $plugin['downloaded']) { ?>
							<a role="button" class="btn btn-primary install" href="<?php echo url("plugin-install-$dir"); ?>"><?php echo lang('install');?></a>
							<?php } ?>
							
							<?php if($plugin['installed'] && $plugin['enable']) { ?>
							<a role="button" class="btn btn-secondary disable" href="<?php echo url("plugin-disable-$dir"); ?>"><?php echo lang('disable');?></a>
							<?php } ?>
							
							<?php if($plugin['installed'] && !$plugin['enable']) { ?>
							<a role="button" class="btn btn-secondary enable" href="<?php echo url("plugin-enable-$dir"); ?>"><?php echo lang('enable');?></a>
							<?php } ?>
							
							<?php if($plugin['installed']) { ?>
							<a role="button" class="btn btn-danger unstall confirm" data-confirm-text="<?php echo lang('plugin_unstall_confirm_tips', array('name'=>$plugin['name']));?>" href="<?php echo url("plugin-unstall-$dir"); ?>"><?php echo lang('unstall');?></a>
							<?php } ?>
							
							<?php if($plugin['have_upgrade']) { ?>
							<a role="button" class="btn btn-primary upgrade" href="<?php echo url("plugin-upgrade-$dir"); ?>"><?php echo lang('update');?></a>
							<?php } ?>
							
						</td>
					</tr>
					<?php } ?>
				</table>
			</div>
		</div>
		
		<?php if($pagination) { ?> <nav class="text-center"><ul class="pagination"><?php echo $pagination; ?></ul></nav> <?php } ?>
		
	</div>
	
</div>

<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>
$('#nav_pc li.plugin, #nav_mobile li.plugin').tab('show');
</script>